package part1.oo.ooday03.ooday03animal;

public class AnimalTest {
    public static void main(String[] args) {
        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("黑黑",2,"黑");
        dogs[1] = new Dog("白白",2,"白");
        dogs[2] = new Dog("灰灰",2,"灰");
        System.out.println(dogs[1].name);
        for (int i = 0; i < dogs.length; i++) {
            System.out.println(dogs[i].color);
            dogs[i].eat();
        }


        Chick[] chicks = new Chick[2];
        chicks[0] = new Chick("小红",2,"红");
        chicks[1] = new Chick("小蓝",2,"蓝");
        chicks[1].age = 4;
        for (int i = 0; i < chicks.length; i++) {
            chicks[i].drink();
        }


        Fish[] fish = new Fish[4];
        fish[0] = new Fish("小金",2,"金");
        fish[1] = new Fish("大金",3,"金");
        fish[2] = new Fish("小紫",4,"紫");
        fish[3] = new Fish("大紫",5,"紫");
        System.out.println(fish[3].name);
        for (int i = 0; i < fish.length; i++) {
            fish[i].swim();
        }
    }
}
